<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>js验证</title>
		<script src="../js/jquery-3.6.3.min.js"></script>
		<script>
			$(function(){
				$("p :radio").click(function(){
					if(this.value=="1"){
						$("span#t1").show();
						$("span#t2").hide();
					}else{
						$("span#t2").show();
						$("span#t1").hide();
					}
				});
				$("form#addForm").submit(function(){
					if($("p :radio:checked").val()=="1"){ 
						let reg=/\S{2,30}/gi; 
						if(!reg.test($("#addr").val())){
							alert("地址不能为空");
							
							return false;
						} 
						return true;
					}
					$("#addr").attr("disabled",true);
					return true; 
				});
			});
		</script>
	</head>
	<body>
		<form action="3.html" id="addForm" >
			<h2>确认收货信息</h2>
			<div aria-disabled="true" onclick="alert(111)">
				sdlkfjsdf
			</div>
			<p>
				<input type="radio" name="choice" value="1" checked	/>送货上门
				<input type="radio" name="choice" value="2"/>快递点自提
			</p>
			<p>
				<span id="t1" >请填写详细的送货地址<input type="text"  name="addr" id="addr"/></span>
				<span id="t2" style="display: none;">请到马鞍山路40号菜鸟物流快递点自提</span>
			</p>
			<p>
				<button>确定</button>
			</p>
		</form>
		<!-- <a href="https://www.baidu.com" disabled>Baidu</a> -->
		<a href="https://www.baidu.com" style="pointer-events: none;">Baidu</a>
	</body>
</html>